package com.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.dao.BrandDao;
import com.entity.Brand;
import com.entity.view.BrandView;
import com.entity.vo.BrandVO;
import com.service.BrandService;
import com.utils.PageUtils;
import com.utils.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("brandService")
public class BrandServiceImpl extends ServiceImpl<BrandDao, Brand> implements BrandService {


        @Override
        public PageUtils queryPage(Map<String, Object> params) {
            Page<Brand> page = this.selectPage(
                    new Query<Brand>(params).getPage(),
                    new EntityWrapper<Brand>()
            );
            return new PageUtils(page);
        }

        @Override
        public PageUtils queryPage(Map<String, Object> params, Wrapper<Brand> wrapper) {
            Page<BrandView> page =new Query<BrandView>(params).getPage();
            page.setRecords(baseMapper.selectListView(page,wrapper));
            PageUtils pageUtil = new PageUtils(page);
            return pageUtil;
        }

        @Override
        public List<BrandVO> selectListVO(Wrapper<Brand> wrapper) {
            return baseMapper.selectListVO(wrapper);
        }

        @Override
        public BrandVO selectVO(Wrapper<Brand> wrapper) {
            return baseMapper.selectVO(wrapper);
        }

        @Override
        public List<BrandView> selectListView(Wrapper<Brand> wrapper) {
            return baseMapper.selectListView(wrapper);
        }

        @Override
        public BrandView selectView(Wrapper<Brand> wrapper) {
            return baseMapper.selectView(wrapper);
        }


    }


